package com.aiwei.tdjk.bean;

import lombok.Data;

/**
 * Created by zhou on 2017/6/5.
 * 营养软件接口参数实体
 */
@Data
public class BaseDataSet {
    /**
     * 会员ID
     */
    private Long memberId;
    /**
     * 营养处方参数:nutrien
     * 运动处方参数:exercise
     * 病人食谱数据参数:dietary
     * 病人食谱制定的分析报告参数:dietaryanalysis
     */
    private String code;
    /**
     * 参数:get
     */
    private String operation;
    /**
     *门诊号
     */
    private String PERSON_ID;
    /**
     * 开始日期
     * 格式：YYYY-MM-dd
     */
    private String BEGIN_DATE;
    /**
     * 截止日期
     * 格式：YYYY-MM-dd
     */
    private String END_DATE;
    /**
     * 门诊访问次数
     */
    private String VISIT_ID;
    /**
     * 食谱日期
     */
    private String ILL_MENU_DATE;
    /**
     * 身份证Id
     */
    private String ID;
    /**
     * 由以上属性进行装配
     */
    private String args;

    public String getArgs() {

        String args = "<DataSet><ARGS_DataTable>";
        if (PERSON_ID != null) {
            args = args + "<PERSON_ID>" + PERSON_ID + "</PERSON_ID>";
        } else {
            args = args + "<PERSON_ID></PERSON_ID>";
        }
        if (!code.equals("patient")) {
            if (VISIT_ID != null) {
                args = args + "<VISIT_ID>" + VISIT_ID + "</VISIT_ID>";
            } else {
                args = args + "<VISIT_ID></VISIT_ID>";
            }
        }
        if (code.equals("dietaryanalysis")) {
            args = args + "<ILL_MENU_DATE>" + ILL_MENU_DATE + "</ILL_MENU_DATE>";
        } else {
            if (BEGIN_DATE != null && END_DATE != null) {
                args = args + "<BEGIN_DATE>" + BEGIN_DATE + "</BEGIN_DATE>" +
                        "<END_DATE>" + END_DATE + "</END_DATE>";
            } else {
                args = args + "<BEGIN_DATE></BEGIN_DATE>" +
                        "<END_DATE></END_DATE>";
            }
        }
        if (code.equals("patient")) {
         if (ID != null) {
            args = args + "<ID>" + ID + "</ID>";
        }else{
            args = args + "<ID></ID>";
         }
        }
        args = args + "</ARGS_DataTable></DataSet>";
        return args;
    }

}
